package com.hse.gui;

/**
 * Created by IntelliJ IDEA.
 * User: Nosov Alexander
 * Date: 05.06.2009
 * Time: 15:42:15
 * To change this template use File | Settings | File Templates.
 */
public class SensorAnalyserTester {
    /*
    private static final Log log = LogFactory.getLog(CoordinatorCreationTester.class);
    SensorAnalyser sensorAnalyser;
    Form form;
    final String port1 = "COM7";
    final String port2 = "COM8";
    final String port3 = "COM9";

    private final Long mac1 = (long) 0;
    private final Long mac2 = (long) 1;
    private final Long mac3 = (long) 2;


    private TempSensor endDevice1;
    private Switcher endDevice2;

    @Before
    public void init() throws InstantiationException {
        log.info("Prepare for test");
        form = new Form();
        sensorAnalyser = new SensorAnalyser(form);
        sensorAnalyser.initCoordinator(port1);
        endDevice1 = new TempSensor(port2, mac2);
        endDevice2 = new Switcher(port3, mac3);

    }

    @After
    public void delete() {
        sensorAnalyser.closeCoordinator();
        log.info("Clean up after test");
        endDevice1.close();
        endDevice2.close();
    }

    @Test
    public void createNetworkTest() throws NetworkException {
        sensorAnalyser.createNetwork();
    }

    @Test
    public void destroyNetworkTest() throws NetworkException {
        sensorAnalyser.createNetwork();
        sensorAnalyser.destroyNetwork();
    }

    @Test(expected = NetworkException.class)
    public void createNetworkTwiceTest() throws NetworkException {
        sensorAnalyser.createNetwork();
        sensorAnalyser.createNetwork();
    }

    @Test
    public void acceptTempSensorTest() throws NetworkException {
        sensorAnalyser.createNetwork();
        endDevice1.scan();
        endDevice1.connect();
        sensorAnalyser.acceptClients();
        Assert.assertNotNull(sensorAnalyser.tempSensor);
        Assert.assertNotNull(sensorAnalyser.tempSensorComponent);
    }

    @Test
    public void acceptTempSwitcherTest() throws NetworkException {
        sensorAnalyser.createNetwork();
        endDevice2.scan();
        endDevice2.connect();
        sensorAnalyser.acceptClients();
        Assert.assertNotNull(sensorAnalyser.tempSwitcher);
        Assert.assertNotNull(sensorAnalyser.tempSwitcherComponent);
    }

    @Test
    public void acceptAllTest() throws NetworkException {
        sensorAnalyser.createNetwork();
        endDevice1.scan();
        endDevice1.connect();
        sensorAnalyser.acceptClients();
        endDevice2.scan();
        endDevice2.connect();
        sensorAnalyser.acceptClients();
        Assert.assertNotNull(sensorAnalyser.tempSensor);
        Assert.assertNotNull(sensorAnalyser.tempSensorComponent);
        Assert.assertNotNull(sensorAnalyser.tempSwitcher);
        Assert.assertNotNull(sensorAnalyser.tempSwitcherComponent);
    }

    @Test
    public void recvDataTest() throws NetworkException {
        sensorAnalyser.createNetwork();
        endDevice1.scan();
        endDevice1.connect();
        sensorAnalyser.acceptClients();
        endDevice2.scan();
        endDevice2.connect();
        sensorAnalyser.acceptClients();
        endDevice1.send("5");
        sensorAnalyser.sendRecieveData();

        int i = ((TempSensorGraphComponent) sensorAnalyser.tempSensorComponent).dataset.getColumnCount();
        int j = ((TempSensorGraphComponent) sensorAnalyser.tempSensorComponent).dataset.getRowCount();
        List x = ((TempSensorGraphComponent) sensorAnalyser.tempSensorComponent).dataset.getColumnKeys();
        Assert.assertEquals(1, ((TempSensorGraphComponent) sensorAnalyser.tempSensorComponent).dataset.getColumnCount());
    }
    */
}
